.remote
  = simple_form_for(@task, html: one_submit_only, remote: true) do |f|
    = link_to_close edit_task_path(@task)
    = hidden_field_tag :view, @view
    = hidden_field_tag "task[asset_id]", "#{@asset.id if @asset}"
    = hidden_field_tag "task[asset_type]", "#{@asset.class if @asset}"

    = render "tasks/top_section",    f: f, edit: true
    = render "fields/groups", f: f, edit: true

    .buttonbar
      = f.submit t :save_task, class: 'btn btn-primary'
      == #{t :or}
      = link_to_cancel edit_task_path(@task)
      == #{t :or} #{t :move_to}
      - [ "due_asap", "due_today", "due_tomorrow", "due_this_week", "due_next_week", "due_later" ].each do |due_day|
        = link_to(t(due_day.to_sym), "#", onclick: %Q/crm.reschedule_task(#{@task.id}, "#{due_day}")/)
        = " | " if due_day != "due_later"
